package com.qhs.sys.controller;




import com.qhs.sys.entity.DictItemInfo;
import com.qhs.sys.service.DictItemInfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Administrator on 2016/11/10 0010.
 */
@RestController
@RequestMapping(value = "/dictInfoItem")
public class DictItemInfoController {
    private final Logger logger = Logger.getLogger(getClass());

    @Autowired
    private DictItemInfoService dictItemInfoService;

    @RequestMapping(value="/", method= RequestMethod.GET)
    public DictItemInfo getMenu() {
        // 处理"/users/"的GET请求，用来获取用户列表
        // 还可以通过@RequestParam从页面中传递参数来进行查询条件或者翻页信息的传递

        return dictItemInfoService.selectByPrimaryKey(new Long(1));
    }

    @RequestMapping("/query/{page}/{pageSize}")
    public PageInfo query(@PathVariable Integer page, @PathVariable Integer pageSize,  DictItemInfo dictItemInfo) {
        if(page!= null && pageSize!= null){
            PageHelper.startPage(page, pageSize);
        }
        List<DictItemInfo>  dictItemInfos = dictItemInfoService.findDictItemInfoList(dictItemInfo);
        return new PageInfo(dictItemInfos);
    }
}
